package com.cai.quartz.job;

import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.PersistJobDataAfterExecution;

/**
 * 有状态job
 */
@Slf4j
@PersistJobDataAfterExecution
public class MyJob3 implements Job {
    @Setter
    private Integer count;
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        log.info("执行任务【服务任务3】");
        ++count;
        log.info("count: "+count);
        //把count存到jobDataMap中
        jobExecutionContext.getJobDetail().getJobDataMap().put("count",count);
    }
}
